package org.red_cross_service.controller;

import org.red_cross_service.common.anno.NoNeedToken;
import org.red_cross_service.common.response.Response;
import org.red_cross_service.domain.Duration;
import org.red_cross_service.service.DurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value ="/api/duration")
@CrossOrigin
public class DurationController {

    @Autowired
    private DurationService durationService;

    @NoNeedToken
    @GetMapping("/get")
    public Response getDuration(){
        return Response.success("成功",durationService.getDuration());
    }

    @NoNeedToken
    @PostMapping("/update")
    public Response updateDuration(@RequestBody Duration duration){
        return Response.success(durationService.setDuration(duration));
    }
}
